﻿using EPiServer;
using EPiServer.DynamicContent;

namespace SocialPack.modules.SocialPack.DynamicContent.Twitter
{
    [DynamicContentPlugIn(
        DisplayName = "Twitter Follow Button",
        Description = "Displays Twitter Follow Button",
        ViewUrl = "~/modules/socialpack/dynamiccontent/twitter/followbutton.ascx")]
    public partial class FollowButton : UserControlBase
    {
        public bool ShowFollowerCount { get; set; }

        public string TwitterName { get; set; }

        public string Language { get; set; }

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            this.FollowButtonControl.ShowFollowerCount = this.ShowFollowerCount;

            if (!string.IsNullOrWhiteSpace(this.TwitterName))
            {
                this.FollowButtonControl.TwitterName = this.TwitterName;
            }

            if (!string.IsNullOrWhiteSpace(this.Language))
            {
                this.FollowButtonControl.Language = this.Language;
            }
        }
    }
}